package com.xdjk.networkdemo.utils;

import java.math.BigDecimal;
import java.math.MathContext;

/**
 * Created by zhanghs on 2017/8/17.
 * 计算相关工具类
 */

public class CalcUtils {
    /**
     * 计算百分比
     * @param numerator 分子
     * @param denominator 分母
     * @return
     */
    public static BigDecimal calcPrecent(long numerator,long denominator) {
        BigDecimal precent = BigDecimal.valueOf(numerator).divide(BigDecimal.valueOf(denominator), new MathContext(2));
        return precent;
    }
}
